package com.muyu.product.service.impl;

import java.util.List;

import com.muyu.common.core.utils.ObjUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import com.muyu.product.mapper.ProjectSkuInfoMapper;
import com.muyu.product.domain.ProjectSkuInfo;
import com.muyu.product.service.ProjectSkuInfoService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;

/**
 * 商品SKUService业务层处理
 *
 * @author DongZeLiang
 * @date 2024-02-27
 */
@Slf4j
@Service
public class ProjectSkuInfoServiceImpl extends ServiceImpl<ProjectSkuInfoMapper, ProjectSkuInfo>  implements ProjectSkuInfoService {

    /**
     * 查询商品SKU列表
     *
     * @param projectSkuInfo 商品SKU
     * @return 商品SKU
     */
    @Override
    public List<ProjectSkuInfo> list(ProjectSkuInfo projectSkuInfo) {
        LambdaQueryWrapper<ProjectSkuInfo> queryWrapper = new LambdaQueryWrapper<>();


        if (ObjUtils.notNull(projectSkuInfo.getProjectId())){
            queryWrapper.eq(ProjectSkuInfo::getProjectId, projectSkuInfo.getProjectId());
        }

        if (ObjUtils.notNull(projectSkuInfo.getSku())){
            queryWrapper.eq(ProjectSkuInfo::getSku, projectSkuInfo.getSku());
        }

        if (ObjUtils.notNull(projectSkuInfo.getStock())){
            queryWrapper.eq(ProjectSkuInfo::getStock, projectSkuInfo.getStock());
        }

        if (ObjUtils.notNull(projectSkuInfo.getPrice())){
            queryWrapper.eq(ProjectSkuInfo::getPrice, projectSkuInfo.getPrice());
        }

        if (ObjUtils.notNull(projectSkuInfo.getImage())){
            queryWrapper.eq(ProjectSkuInfo::getImage, projectSkuInfo.getImage());
        }





        return list(queryWrapper);
    }
}
